package com.cskaoyan.controller;

import com.cskaoyan.bean.bo.WxCcollectAddorDeleteBo;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.WxCollectListVo;
import com.cskaoyan.service.WxCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 商品收藏
 * @author: Tao
 * @time: 2023/1/1 14:50
 */
@RestController
@RequestMapping("wx/collect")
public class WxCollectController {
    @Autowired
    WxCollectService collectService;

    /**
     * 完成商品收藏的添加或者删除操作
     *
     * @param addordeleteBo
     * @return
     */
    @RequestMapping("addordelete")
    public BaseRespVo addordelete(@RequestBody WxCcollectAddorDeleteBo addordeleteBo) {
        //执行商品收藏的添加或者删除操作
        collectService.addordelete(addordeleteBo);
        return BaseRespVo.ok("成功");
    }

    /**
     * 完成查看收藏的功能
     *
     * @param info
     * @param type
     * @return
     */
    @RequestMapping("list")
    public BaseRespVo list(BasePageInfo info, Byte type) {
        CommonData<WxCollectListVo> data = collectService.gitList(info, type);
        return BaseRespVo.ok(data, "成功");
    }

}
